<div class="menuses index">
	<h2><?php echo __d('menuses','Menu',true)?>: <?php echo $this->Html->link($this->Session->read('Config.Domain.Domain.name'),'http://'.$this->Session->read('Config.Domain.Domain.name')); ?></h2>
		<table cellpadding = "0" cellspacing = "0">
		<tr>
			<th><?php echo __d('menuses','Id'); ?></th>
			<th><?php echo __d('menuses','Position'); ?></th>
			<th><?php echo __d('menuses','Name'); ?></th>
			<th><?php echo __d('menuses','Articles'); ?></th>
			<th><?php echo __d('menuses','Status'); ?></th>
			<th class="actions"><?php echo $this->Html->link(__d('menuses','+ Add'), array('controller' => 'menuses', 'action' => 'add'));?></th>
		</tr>
		<?php if (!empty($menuses)):?>
		<?php
			$i = 0;
			foreach ($menuses as $menus): ?>
			<tr>
				<td onclick="document.location='<?php echo $this->Html->url(array('controller' => 'menuses', 'action' => 'edit', $menus['id']),true);?>'"><?php echo $menus['id'];?></td>
				<td onclick="document.location='<?php echo $this->Html->url(array('controller' => 'menuses', 'action' => 'edit', $menus['id']),true);?>'"><?php $p = (is_null($menus['position']) || $menus['position'] == 0 ) ? 0 :$menus['position'];  echo  $menu_positions[$p];?></td>
				<td style="width: 250px;" onclick="document.location='<?php echo $this->Html->url(array('controller' => 'menuses', 'action' => 'edit', $menus['id']),true);?>'"><?php echo $menus['name'];?></td>				
				<td>
				<?php 
					
					$total = count($menus['article']);
					if(is_array($menus['article'])){
					echo '<ul>';	
					foreach ( $menus['article'] as $key => $a) {
						echo '<li>'.$this->Html->link($a['name'],array('controller'=>'articles','action'=>'edit',$a['id'])).'</li>';
					}
					echo '</ul>';
					}
				?>
	
				</td>
				<td><?php echo $this->Form->input('Menus.status',array('value'=>$menus['status'],'label'=>false,'type'=>'checkbox','checked'=>$menus['status']));?></td>
				<td class="actions">
					<?php 
						echo $this->Html->link(__d('menuses','Articles'), array('controller' => 'articles', 'action' => 'index',$menus['id']),array('class'=>'action-left'));
						echo $this->Form->postLink('⇡', array('controller' => 'menuses','action' => 'up', $menus['id'],1),array('class'=>'action-inner'));
						echo $this->Form->postLink('⇣', array('controller' => 'menuses','action' => 'down', $menus['id'],1),array('class'=>'action-inner'));
						echo $this->Html->link('+', array('controller' => 'menuses', 'action' => 'add','pi'=>$menus['id']),array('class'=>'action-inner'));
						echo $this->Html->link(__d('menuses','Edit'), array('controller' => 'menuses', 'action' => 'edit', $menus['id']),array('class'=>'action-inner'));
						echo $this->Form->postLink(__d('menuses','Delete'), array('controller' => 'menuses', 'action' => 'delete', $menus['id']), array('style'=>'margin-right: 5px;','class'=>'action-right'), __d('menuses','Are you sure you want to delete # %s?', $menus['id']));
					?>
				</td>
			</tr>
		<?php endforeach; ?>
		<?php endif; ?>
		</table>

</div>
<?php echo $this->element('/menu/left')?>
